<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'login.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
      
     
    <script type="text/javascript">   
    function check()   
    {   
    if (document.all.username.value=="")   
    {   
      alert("请输入用户名!!");   
        
      return false;   }   
    if (document.all.passwd.value=="")   
    {   
      alert("请输入密码!!");   
      //form1.passwd.focus();   
      return false;   
      }
     if (document.all.rand.value=="")   
    {   
      alert("请输入验证码!!");  
       return false;   
      } 
      return true;  
    }
     </script>
     <script language="javascript">
	function loadimage(){
	   document.getElementById("randImage").src ="image.jsp?"
	   + Math.random();}
	  </script>
	  <script language="javascript">
	  function keyLogin(){
	      if(event.keyCode==13)
	         document.getElementByName("Submit").click();
	  }
	  </script>
  </head>
  
  <body onkeydown="keyLogin();">
  <a href="http://127.0.0.1:8080/bookstore/register.jsp">新用户注册</a>
<div align=center><font size="4"><strong>用户登录</strong></font></div>
    <form name="form1"  method="post" action="login_result.jsp">
                 
          <table width="476" border="0" cellspacing="1" cellpadding="1" align="center">
          <br>
            <tr> 
              <td width="95" align="right">用户名：</td>
              <td width="157"> 
                <input type="text" name="username" size="15" maxlength="25">
              </td>
            </tr>
            <tr> 
              <td align="right">密&nbsp;&nbsp;码：</td>
              <td> 
                <input type="password" name="passwd" size="15" maxlength="20">
              </td>
            </tr>
            <tr> 
             <td align="right">验证码：</td>
              <td> 
                <input type="text" name="rand" size="15" maxlength="25">
              </td> 
             <td width="214" valign="middle" align="center">
             <img alt="code..." name="randImage" id="randImage"
              src="image.jsp" width="60" height="20" border="1" align="absmiddle">
              <a href="javascript:loadimage();"><font class=pt95>看不清，换一张</font></a></td>
            </tr>
            <tr>
              <td height="36" colspan="2" align="center" valign="middle">
              <a href="javascript:loadimage();"></a>
              </td>
                 </tr>
            <tr> 
              <td colspan="2" align="center"> 
                <input type="submit" name="Submit" value="登录">
                <a>&nbsp; &nbsp;</a>
                <input type="reset" name="Submit2" value="重置">
              </td>
            </tr>
             <tr>     
           	<td colspan="2" align="center">
        	 <p>&nbsp;</p>
         	</td>
   	    </tr>
         </table>
   </form>
  </body>
</html>

